<!DOCTYPE html>
<html>
<head>
    <title>server_2</title>
</head>
<body>
    <h1>客户端跨域访问（子域名页面）</h1>
    <h2>
        当前路径：<span id="cururl"></span>
    </h2>
    子域名的数据：
    <div id="result"></div>
    
    <script>
        document.getElementById('cururl').innerHTML = window.location.href;
        
        // 设置document.domain
        document.domain = 'websecurity.com';
        
        try {
            var parentData = window.parent.getParentData();
            document.getElementById('result').innerHTML = parentData;
        } catch(e) {
            document.getElementById('result').innerHTML = '访问失败: ' + e.message;
        }
    </script>
</body>
</html>